package com.chinasofti.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class MyThreadPoolDemo {
    public static void main(String[] args) {
        ExecutorService extendedService = Executors.newCachedThreadPool();
        //ExecutorService 帮助我们控制线程

        extendedService.submit(()->{
            System.out.println(Thread.currentThread().getName()+"在执行了");
        });
        extendedService.submit(()->{
            System.out.println(Thread.currentThread().getName()+"在执行了");
        });
        extendedService.shutdown();

    }
}
